#define _CRT_SECURE_NO_WARNINGS 1
#include <climits>
#include <iostream>
#include <iterator>
using namespace std;
class date1
{
public:
    date1(int year, int month, int day)
    {
        _day = day;
        _month = month;
        _year = year;
    }
    int GetMonDays(int year, int month)
    {
        static int MonArr[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
        if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)))
            return 29;
        else
        {
            return MonArr[month - 1];
        }
    }
    void operator+=(int day);
    void Print();
    int _day = 0;
    int _month = 0;
    int _year = 0;
};
void date1::Print()
{
    cout << _year << "-";
    if (_month < 10)
        cout << "0" << _month << "-";
    else
        cout << _month << "-";
    if (_day < 10)
        cout << "0" << _day << endl;
    else
        cout << _day << endl;
}
void date1::operator+=(int day)
{
    _day += day;
    while (_day > GetMonDays(_year, _month))
    {
        _day -= GetMonDays(_year, _month);
        _month++;
        if (_month == 13)
        {
            _month = 1;
            _year++;
        }
    }
}
int main()
{
    int year, day = 0;
    while (scanf("%d%d", &year, &day) != EOF)
    {
        date1 d1(year, 1, 0);
        d1 += day;
        d1.Print();
    }
    return 0;
}